import { createApp } from 'vue';
import type { App as AppType } from 'vue';
import App from './App.vue';
import { router, setupRouter } from '@/router';
import { AppConfig } from './config/app';
import { setupStore } from './pinia';
import { setupPlugins } from './plugins';
import { registeGlobalComponent } from '@/components';
import '@/styles/index.scss';

/**
 * 将全局静态配置注入到应用中,可以通过 this.a读取,比 provide 和 inject 手动注入更方便
 */
const app: AppType = createApp(App);
app.config.globalProperties = AppConfig;

setupRouter(app);
setupStore(app);
setupPlugins(app);
registeGlobalComponent(app);

router.isReady().then(() => app.mount('#app'));
